package cn.highedu.demo;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

import java.util.ArrayList;

@Configuration
@ComponentScan("cn.highedu.demo")
public class MyConfig {

    @Bean
    public ArrayList<String> names() {
        ArrayList<String> names = new ArrayList<>();
        names.add("Tom");
        names.add("Jerry");
        return names;
    }

    @Bean
    public User user() {
        System.out.println("创建User对象");
        return new User();
    }

//    @Bean
//    public User user1() {
//        System.out.println("创建User对象1");
//        return new User();
//    }
}
